home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / HELPCTIT.PRG < prev    next >
Text File  |  1993-05-04  |  2KB  |  89 lines

  1. *' $Header: $
  2. FUNCTION HelpCTit
  3. PARAMETERS pcMsg, pnWidth, plBar
  4. *----------------------------------------------------------------------------
  5. * NAME
  6. *   HelpCTit() - 
  7. *
  8. * SYNOPSIS
  9. *   HelpCTit( pcMsg, pnWidth )
  10. *
  11. * DESCRIPTION
  12. *
  13. * PARAMETERS
  14. *   pcMsg      = 
  15. *   pnWidth    = 
  16. *   plBar      = .f., use space padding; .t., use bar padding
  17. *
  18. * EXAMPLE
  19. *
  20. * LIMITATIONS
  21. *
  22. * DEPENDENCIES
  23. *
  24. * SEE ALSO
  25. *
  26. *----------------------------------------------------------------------------
  27.   IF plBar
  28.     cBar    = CHR( 205 )
  29.     cOpen   = "["           && CHR( 181 )
  30.     cClose  = "]"           && CHR( 198 )
  31.   ELSE
  32.     cBar    = " " && CHR( 205 )
  33.     cOpen   = " " && CHR( 181 )
  34.     cClose  = " " && CHR( 198 )
  35.   ENDIF
  36.  
  37.   cMsg    = TRIM( pcMsg )
  38.   nMsgLen = LEN( cMsg )
  39.   IF MOD( nMsgLen, 2 ) = 0
  40.     cMsg = cMsg + " "
  41.     nMsgLen = nMsgLen + 1
  42.   ENDIF
  43.  
  44.   cResult = ""
  45.   nHalfWid = INT( pnWidth / 2 )
  46.   nHalfMsg = INT( nMsgLen / 2 )
  47.   nPosMsg  = nHalfWid - nHalfMsg + 1
  48.   nPosOpen = nPosMsg - 3
  49.   nBars    = nPosOpen - 1
  50.  
  51.   IF nBars > 0
  52.     cResult = REPLICATE( cBar, nBars )
  53.   ENDIF
  54.  
  55.   IF nPosOpen > 0
  56.     cResult = cResult + cOpen
  57.   ENDIF
  58.  
  59.   IF nPosMsg < 3
  60.     nPad = nPosMsg - 1
  61.     IF nPad > 0
  62.       cSpaces = SPACE( nPad )
  63.     ELSE
  64.       cSpaces = ""
  65.     ENDIF
  66.   ELSE
  67.     cSpaces = SPACE( 2 )
  68.   ENDIF
  69.  
  70.   cResult = cResult + cSpaces + cMsg + cSpaces
  71.  
  72.   IF nPosOpen > 0
  73.     cResult = cResult + cClose
  74.   ENDIF
  75.  
  76.   IF nBars > 0
  77.     cResult = cResult + REPLICATE( cBar, nBars )
  78.   ENDIF
  79.  
  80.   cResult = LEFT( cResult + SPACE( pnWidth ), pnWidth )
  81.  
  82. RETURN( cResult )
  83. *-- EOF: HelpCTit( pcMsg, pnWidth )
  84. *'----------------------------------------------------------------------------
  85. *' $Log: $
  86. *'----------------------------------------------------------------------------
  87.  
  88.  
  89.